package com.yueya.api.knowledge;

import com.jfinal.aop.Before;
import com.jfinal.aop.Duang;
import com.jfinal.kit.JsonKit;
import com.yueya.common.action.ApiController;
import com.yueya.common.action.ApiInterceptor;
import com.yueya.common.model.Resp;

import net.sf.json.JSONObject;

/**
 * 知识库管理
 * @author 98550
 *
 */
@Before(ApiInterceptor.class)
public class IKnowledgeController extends ApiController {
	
	// 获取知识
	public void getPageKnowledge() {
		JSONObject jo = this.getJson();
		Resp resp = Duang.duang(IKnowledgeService.class).getPageKnowledge(jo);
		renderJson(JsonKit.toJson(resp));
	}
	
	// 添加知识
	public void addKnowledge() {
		JSONObject jo = this.getJson();
		Resp resp = Duang.duang(IKnowledgeService.class).addKnowledge(jo);
		renderJson(JsonKit.toJson(resp));
	}
	
	public void updateKnowledge() {
		JSONObject jo = this.getJson();
		Resp resp = Duang.duang(IKnowledgeService.class).updateKnowledge(jo);
		renderJson(JsonKit.toJson(resp));
	}
	
	public void deleteKnowledge() {
		JSONObject jo = this.getJson();
		Resp resp = Duang.duang(IKnowledgeService.class).deleteKnowledge(jo);
		renderJson(JsonKit.toJson(resp));
	}
	
	public void getOneKnowledge() {
		JSONObject jo = this.getJson();
		Resp resp = Duang.duang(IKnowledgeService.class).getOneKnowledge(jo);
		renderJson(JsonKit.toJson(resp));
	}
	
	public void getKnowledgeTypes() {
		JSONObject jo = this.getJson();
		Resp resp = Duang.duang(IKnowledgeService.class).getKnowledgeTypes(jo);
		renderJson(JsonKit.toJson(resp));
	}

}
